Skip to content

Conversation

@samojavo
Copy link
Contributor

@samojavo samojavo commented Nov 3, 2025

• Make all example entry points pass mypy when run individually (with --ignore-missing-imports).
• Add a small helper script (dev/mypy_check_examples.ps1) and a brief note in dev/README.md.

Closes #1091

Copy link
Member

@georgeh0 georgeh0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanups!

@cocoindex.op.function()
def markdown_to_html(text: str) -> str:
return _markdown_it.render(text)
return cast(str, _markdown_it.render(text))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking about also considering code simplicity/readability. Given these examples are for users to understand how to use cocoindex, this matters.

For case like this, it's essentially the underlying library doesn't have a specific type, and the return type of the current function is clear.
I think we can just ignore it by a comment like # type: ignore

(IMO cast(...) is more useful for values within a function - from the point on, the type is clear)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve this comment and avoid cast(...) for function return types, and use # type: ignore comment instead. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@samojavo
Copy link
Contributor Author

is it fine this time?

@georgeh0
Copy link
Member

is it fine this time?

Hi @samojavo, please resolve the first comment above. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check out for mypy type errors in the examples and clean up

2 participants